/*
 * @Author: Smthie Smthie@qq.com
 * @Date: 2024-05-16 11:01:58
 * @LastEditors: Smthie Smthie@qq.com
 * @LastEditTime: 2024-05-31 15:50:08
 * @FilePath: \ProtocolTool\src\renderer\src\api\OneClick.ts
 */
import request from '@/utils/request'
import axios from 'axios'

// 获取在线设备列表
export const getOnlineDeviceAPI = () => request.get('/instr-info/onlineList')

// 获取一键测试配置
export const getTestConfigAPI = () => request.get('/sysConfig/list')

// 更新一键测试配置
export const updateTestConfigAPI = (data) => request.post('/sysConfig/batch/update', data)

// 一键测试
export const MQTTTestAPI = (data) => request.post('/instruct/oneKey/test', data)

// Socket一键测试
export const socketTestAPI = (data) => request.post('/socket/oneKey/test', data)

// 终止测试
export const stopTestAPI = (params) => request.get('/instruct/oneKey/stop', { params })

// 获取一键测试列表
export const getTestPageAPI = (params) => request.get('/test-info/page', { params })

// 获取测试详情
export const getTestDetailAPI = (id) => request.get('/test-info/getDetailById?id=' + id)

// 删除测试记录
export const deleteTestAPI = (id) => request.delete(`/test-info/deleteById/${id}`)

// 导出测试记录
export const exportTestAPI = (id) =>
  axios({
    baseURL: import.meta.env.RENDERER_VITE_BASE_API,
    timeout: 5000,
    url: `/test-info/testReportPdf/${id}`,
    method: 'get',
    responseType: 'blob'
  })
